// 判断模块是否安装了
function  packageExists (packageName){
  try {
    return require.resolve(packageName)
  } catch {
    return false
  }
}

console.log('模块', packageExists('webpack'))

new Promise((resolve, reject) => {
  setTimeout(() => {
    reject('2321')
  })
})
  .then(() => {
    console.log('231ds范德萨')
  })
  .catch((err) => {
    console.log(`发生错误了1: ${err}`)
  })
  .catch((err) => {
    console.log(`发生错误了2: ${err}`)
  })
